package practice;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * dp动态规划算法：状态表示 + 状态计算
 *   状态表示：集合 + 属性
 *      集合：f(i,j) 只从前 i 个砝码中选，且称出来总重量为 j 的可行性的集合;
 *      属性：boolean
 *   状态计算：+ - 不选
 *      + ：f(i,j) = f(i-1,j-wi);
 *      - ：f(i,j) = f(i-1,j+wi);
 *      不选 ： f(I,j) = f(i-1,j);
 *   综上：f(i,j) = f(i-1,j-wi) || f(i-1,j+wi) || f(i-1,j);
 */
public class _12Weight {
    final static int OFF = 100000;
    static int n;
    static int max;
    static int[] w;
    static boolean[][] dp;
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String[] strings = in.readLine().split(" ");
        n = Integer.parseInt(strings[0]);
        w = new int[n];
        strings = in.readLine().split(" ");
        in.close();
        for (int i = 0;i < n;i++){
            w[i] = Integer.parseInt(strings[i]);
            max += w[i];
        }

        dp = new boolean[n+1][OFF * 2 + 10];
        //  Wi=j时，因为f[0][0]=false，导致f[i][j]=false，应该把f[0][0]=true，最后计数时再减掉
        dp[0][OFF] = true;
        for (int i = 1;i <= n;i++){
            for (int j = -max;j <= max;j++){
                dp[i][j + OFF] = dp[i-1][j + OFF];
                if (j - w[i-1] >= -max){
                    dp[i][j + OFF] |= dp[i-1][j - w[i-1] + OFF];
                }
                if (j + w[i-1] <= max){
                    dp[i][j + OFF] |= dp[i-1][j + w[i-1] + OFF];
                }
            }
        }
        int res = 0;
        for (int j = 0;j < max;j++){
            if (dp[n][j + OFF])
            res++;
        }
        System.out.println(res);
    }
}
